
package Objects;

import GameEngine.GameConstants.Effect;
import GameEngine.GameConstants.Graphic;
import GameEngine.GameConstants.Material;
import GameEngine.GameConstants.Modifier;
import GameEngine.GameConstants.Thing;
import GameEngine.Vector;



/**
 *
 * @author mhfowler
 */
public class Wind extends GameObject {


    // constructor
    public Wind(Vector dir, Vector cen, Vector s, Graphic g) {
        super(dir, cen, s, g);
        material = Material.WIND;
        isTangible = false;
    }

    // set wind strength by setting its velocity
    public void setWind(Vector v) {
        velocity = v;
    }


     /** this is the method by which other objects will effect this object. There will be a switch case
     * for each effect. For this abstract object, there will be a default implementation for each effect.
     * Specifiec objects will overwrite this method, but within them their default switch case will
     * be super.receiveEffect(), which will cause these default effects. */
    @Override
    public void receiveEffect(Effect e, Vector dir, int power) {
        switch (e) {
            case DESTROY:
                super.receiveEffect(e, dir, power);
                break;
            default:
                // do nothing
                break;
        }
    }

    /**
     * Destroy the wind after a period of time
     */

    @Override
    public void nextIteration() {
        // super.nextIteration();
        if (lifetime > 20) {
            this.receiveEffect(Effect.DESTROY, size, lifetime);
        }
    }

    /** this method will be called on both objects in a collision wherever the collision checker detects
     * a collision. By default this method will be made up of a switch case of Material, but particular
     * objects may have more interesting and nefarious collision behavior, including calling receiveEffect
     * on the object they collided with, causing an effect on their group, or causing an effect on themself.
     * @param o
     */
    @Override
    public void collide(GameObject o) {
        switch (o.material) {
            case WALL:
                super.collide(o);
                this.receiveEffect(Effect.DESTROY, null, 0);
                break;
            case VACUUM:
                this.receiveEffect(Effect.DESTROY, null, 0);
                break;
            case WIND:
                super.collide(o);
                break;
            default:
                //nothing
                break;
        }
    }


    





}
